package net.gxf.common.util;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

/**
 * 
 * @author: maybe
 * 
 */
public class NetworkLocation implements ResourceLocation {

	@Override
	public InputStream getResourceAsStream(String ref) {
		try {
			URL u = new URL(ref);
			URLConnection conn = u.openConnection();
			return conn.getInputStream();
		} catch (MalformedURLException e) {
			return null;
		} catch (IOException e) {
			return null;
		}
	}

	@Override
	public URL getResource(String ref) {
		try {
			return new URL(ref);
		} catch (MalformedURLException e) {
			return null;
		}
	}

}
